home *** CD-ROM | disk | FTP | other *** search
/ D.I.S.C. 6 / D.I.S.C. 6.adf / sources / sinus1.s < prev    next >
Text File  |  1987-05-04  |  11KB  |  368 lines

  1. ; ------------ Sinscroller -------------
  2. ; For the CJ Assembler Lesson
  3. ; (c) 1990 Doctor Mabuse
  4. ; the Alpha Flight
  5. ; --------- Important Infos !! ---------
  6. ; As usual get the font calles "data"
  7. ; with the -y- command. As you can see,
  8. ; the routine is preset as a two pixel
  9. ; sinus scroller. It's no problem to
  10. ; change it into a one pixel profi-
  11. ; scroller but beware of the raster.
  12. ; The flickering green shows where the
  13. ; raster line has arrived when the
  14. ; routine has fnished. When it's at the
  15. ; bottom of the screen you have lost.
  16. ; To remove it look for the move in the
  17. ; interrupt.
  18. ; For changing into a 1 or 4 pixel
  19. ; sinus (depending on the available
  20. ; raster time) look for the marked
  21. ; positions in the routine. You must
  22. ; change the blitter mask and at a 
  23. ; second place the shift value of
  24. ; the blitter mask. When you make a
  25. ; One pixel sinus or even with a two
  26. ; pixel one you will notice that the
  27. ; scroller is scrambled at the right
  28. ; end. In this case the routine didn't
  29. ; already finished when the raster line
  30. ; reached this point. To avoid it you
  31. ; must work with double buffering. Make
  32. ; two screens. One for blitting and the
  33. ; other for beeing displayed. Every
  34. ; interupt you swap them, it's very
  35. ; easy. Also you must make a longer
  36. ; sinus wave. The sinus is peridically
  37. ; and you must add another 256 degree
  38. ; turn for the new 160 positions.
  39. ; Try it and good luck!
  40. ;            Yours         DRM
  41. ; ------------- Nachladen --------------
  42. >extern "data7",$60000,$fffff
  43. jmp        $50000
  44. org        $50000
  45. load        $50000
  46. ; -------------- Offsets ---------------
  47. vbeampos=    -384
  48. openlibrary=     -408
  49. closelibrary=     -414
  50. forbid=     -132
  51. permit=     -138
  52. execbase=     $04
  53. ; --------------------------------------
  54. start:
  55. movem.l     d0-d7/a0-a6,-(a7)    ; Save registers
  56. ; --------------------------------------
  57. ; ------- Graphics Libary oeffnen ------
  58. move.l        execbase,a6
  59. lea        gfxname,a1     
  60. jsr        openlibrary(a6)
  61. beq        end
  62. move.l        d0,gfxbase
  63. ; -------- Prepare Sinus Table ---------
  64. move.l        #sin,a0
  65. ll:
  66. move.w        (a0),d1
  67. muls        #30,d1            ; Amplitude of the sinus wave!!
  68. asr.l        #8,d1
  69. muls        #44,d1
  70. add.l        #$61000+[140*44],d1    ; Middle line of sinus wave
  71. move.w        d1,(a0)+
  72. cmp.l        #send,a0
  73. bne        ll
  74. ; ----------- Clear screen -------------
  75. move.w        #10,d1
  76. sy:
  77. move.l        #$60fd0,a0
  78. move.w        #$1000,d0
  79. sz:
  80. move.l        #0,(a0)+
  81. dbra        d0,sz
  82. dbra        d1,sy
  83. ; --------------------------------------
  84. move.l        execbase,a6
  85. jsr        forbid(a6)
  86. ; ---- Eigene Copperliste einsetzen ----
  87. move.l        gfxbase,a0
  88. add.l        #$32,a0
  89. move.w        #$0080,$dff096
  90. move.l        (a0),oldcopper
  91. move.l        #newcopper,(a0)
  92. move.w        #$8080,$dff096
  93. ; --------- Change IRQ vector ----------
  94. move.l        $6c,oldirq
  95. move.l        #newirq,$6c
  96. ; ------- Main program Waitloop --------
  97. main:
  98. btst        #6,$bfe001
  99. bne        main
  100. ; --------------------------------------
  101. move.l        oldirq,$6c
  102. ; --------- close GFX-Library ----------
  103. move.l        execbase,a6
  104. move.l        gfxbase,a1
  105. jsr        closelibrary(a6)
  106. ; ----- write old Copperlist back  -----
  107. move.l        gfxbase,a0
  108. add.l        #$32,a0
  109. move.w        #$0080,$dff096
  110. move.l        oldcopper,(a0)
  111. move.w        #$8080,$dff096
  112. ; ------ reactiveate Multitasking ------
  113. move.l        execbase,a6
  114. jsr        permit(a6)
  115. ; --------------- Exit -----------------
  116. movem.l        (a7)+,d0-d7/a0-a6
  117. end:
  118. rts
  119. ; --------------------------------------
  120. ; --------------------------------------
  121. newirq:                    ; Our interrupt
  122. movem.l        d0-d7/a0-a6,-(sp)    ; Save registers
  123. ; --------------------------------------
  124. cmp.b        #$7f,$bfec01        ; Check space key
  125. beq        i0
  126. bsr        ppppp1
  127. i0:
  128. bsr        copy
  129. move.w        #$320,$dff180        ; Set backgroundcolour. Remove
  130.                     ; when you want it. It shows when
  131.                     ; the blitterroutine has
  132.                     ; finished. When this mark comes
  133.                     ; into the area of the sinus
  134.                     ; this will be spoiled. Then you
  135.                     ; must use double buffering.
  136. ; --------------------------------------
  137. movem.l        (sp)+,d0-d7/a0-a6    ; IRQ End
  138. dc.w        $4ef9
  139. oldirq:
  140. dc.l        0
  141. ; --------------------------------------
  142. ppppp1:
  143. move.l        #$61000,$dff050
  144. move.l        #$60ffe,$dff054
  145. move.l        #$00000000,$dff064
  146. move.l        #$ffff0fff,$dff044
  147. move.l        #$e9f00000,$dff040
  148. move.w        #[14*1]*64+$16,$dff058
  149. pend:
  150. btst        #6,$dff002
  151. bne.s        pend
  152. ; --------------------------------------
  153. add.w        #2,srr 
  154. cmp.w        #18,srr
  155. bcs.s        no
  156. move.w        #0,srr
  157. bsr.s        print1            ; neues zeichen ausgeben
  158. no:
  159. rts
  160. srr:    dc.w    0
  161. sxx:    dc.l    msg
  162. ; --------------------------------------
  163. print1:
  164. clr.l        d0
  165. clr.l        d1
  166. move.l        sxx,a0
  167. move.b        (a0),d0
  168. sub.b        #32,d0
  169. bpl        nnm
  170. move.b        #16,d0
  171. nnm:
  172. move.b        d0,d1
  173. divu        #20,d1
  174. move.w        d1,d2
  175. swap        d1
  176. move.w        d1,d3
  177. mulu        #2,d3
  178. mulu        #14*40,d2
  179. add.w        d2,d3
  180. move.l        #$60000,d0
  181. add.w        d3,d0
  182. move.l        d0,$dff050
  183. move.l        #$61028,$dff054        ; Blit Source
  184. move.l        #$0026002a,$dff064    ; Modulo
  185. move.l        #$ffffffff,$dff044    ; Maske
  186. move.l        #$09f00000,$dff040    ; Modus
  187. move.w        #13*1,d0        ; Hoehe
  188. asl.w        #6,d0
  189. add.w        #1,d0            ; Breite
  190. move.w        d0,$dff058        ; Start
  191. lend:
  192. btst        #6,$dff002        ; Warten
  193. bne.s        lend
  194. add.l        #1,sxx            ; naechstes Zeichen
  195. cmp.l        #ende,sxx
  196. bcs        eee
  197. move.l        #msg,sxx
  198. eee:
  199. rts
  200. ; ----------- Sinuskopieren ------------
  201. copy:
  202.                     ; Clear sinus area. Take care
  203. move.l    #$61000+[108*44],$dff054    ; that you clear the right
  204. move.l    #$00040004,$dff064        ; area. And clear enought but
  205. move.l    #$0000ffff,$dff044        ; not more than necessary.
  206. move.l    #$01000000,$dff040
  207. move.w    #[76*1]*64+$14,$dff058        ; Size of clearing
  208. clend:                    ; Wait
  209. btst    #6,$dff002
  210. bne.s    clend
  211. ; --------------------------------------
  212. add.w        #3,cx            ; This counter lets your sinus
  213. cmp.w        #256*2,cx        ; wave move with the set speed
  214. bcs        cno
  215. move.w        #0,cx
  216. cno:
  217. move.l        #$61000,d1
  218. move.l        #$60000,d3
  219. clr.l        d4
  220. move.l        #sin,a0
  221. move.w        cx,d0
  222. and        #$fffe,d0
  223. add.w        d0,a0
  224. move.l        #$002a002a,$dff060    ; Modulo Values for Blitter
  225. move.l        #$002a002a,$dff064
  226. move.w        #-1,$dff046        ; Second Mask Word must be filled
  227.  
  228. cn1:                    ; Extern loop: For getting all
  229.                     ; 20 words of one line
  230. move.w        #$c000,d2        ; Set blit mask. For one (four)
  231.                     ; pixel sinus set to $8000
  232.                     ; ($f000)
  233. cn2:                    ; Intern loop: Copies from your
  234.                     ; word one, two or four bits
  235.                     ; together in 16, 8 or 4 steps.
  236.  
  237. move.w        (a0),d3            ; Endadress of Sinus List
  238. add.w        d4,d3
  239. move.l        d1,$dff050        ; A
  240. move.l        d3,$dff048        ; C
  241. move.l        d3,$dff054        ; D
  242. move.w        d2,$dff044        ; Set Mask
  243. move.l        #$0b5a0000,$dff040
  244. move.w        #[13*1]*64+$1,$dff058
  245. cend:
  246. btst        #6,$dff002
  247. bne.s        cend
  248.  
  249. add.w        #2,a0
  250. lsr        #2,d2            ; Shift Blitter mask left for
  251.                     ; copying the other bits of
  252.                     ; this word. For one (four)
  253.                     ; pixel scroller set to 1 (4)!
  254. bne        cn2
  255. add.l        #2,d1
  256. add.l        #2,d4
  257. cmp.l        #$28,d4
  258. bne        cn1
  259. rts
  260. ; ---------------- Datas ---------------
  261. cx:    dc.w    0
  262. sin:                    ; Sinusnumbers. This sinus table
  263.                     ; has 256 degrees. Important! In
  264.                     ; the Init part a routine 
  265.                     ; multiplicates a values with
  266.                     ; the size of one screen line
  267.                     ; and adds the base adress!!!!
  268. DC.W    $0100,$0100,$0100,$00FF,$00FF,$00FE,$00FD,$00FC
  269. DC.W    $00FB,$00FA,$00F8,$00F7,$00F5,$00F3,$00F1,$00EF
  270. DC.W    $00ED,$00EA,$00E7,$00E5,$00E2,$00DF,$00DC,$00D8
  271. DC.W    $00D5,$00D1,$00CE,$00CA,$00C6,$00C2,$00BE,$00B9
  272. DC.W    $00B5,$00B1,$00AC,$00A7,$00A2,$009D,$0098,$0093
  273. DC.W    $008E,$0089,$0084,$007E,$0079,$0073,$006D,$0068
  274. DC.W    $0062,$005C,$0056,$0050,$004A,$0044,$003E,$0038
  275. DC.W    $0032,$002C,$0026,$001F,$0019,$0013,$000D,$0006
  276. DC.W    $0000,$FFFA,$FFF3,$FFED,$FFE7,$FFE1,$FFDA,$FFD4
  277. DC.W    $FFCE,$FFC8,$FFC2,$FFBC,$FFB6,$FFB0,$FFAA,$FFA4
  278. DC.W    $FF9E,$FF98,$FF93,$FF8D,$FF87,$FF82,$FF7C,$FF77
  279. DC.W    $FF72,$FF6D,$FF67,$FF62,$FF5E,$FF59,$FF54,$FF4F
  280. DC.W    $FF4B,$FF47,$FF42,$FF3E,$FF3A,$FF36,$FF32,$FF2F
  281. DC.W    $FF2B,$FF28,$FF24,$FF21,$FF1E,$FF1B,$FF19,$FF16
  282. DC.W    $FF13,$FF11,$FF0F,$FF0D,$FF0B,$FF09,$FF08,$FF06
  283. DC.W    $FF05,$FF04,$FF03,$FF02,$FF01,$FF01,$FF00,$FF00
  284. DC.W    $FF00,$FF00,$FF00,$FF01,$FF01,$FF02,$FF03,$FF04
  285. DC.W    $FF05,$FF06,$FF08,$FF09,$FF0B,$FF0D,$FF0F,$FF11
  286. DC.W    $FF13,$FF16,$FF19,$FF1B,$FF1E,$FF21,$FF24,$FF28
  287. DC.W    $FF2B,$FF2F,$FF32,$FF36,$FF3A,$FF3E,$FF42,$FF47
  288. DC.W    $FF4B,$FF4F,$FF54,$FF59,$FF5E,$FF63,$FF68,$FF6D
  289. DC.W    $FF72,$FF77,$FF7C,$FF82,$FF87,$FF8D,$FF93,$FF98
  290. DC.W    $FF9E,$FFA4,$FFAA,$FFB0,$FFB6,$FFBC,$FFC2,$FFC8
  291. DC.W    $FFCE,$FFD4,$FFDA,$FFE1,$FFE7,$FFED,$FFF3,$FFFA
  292. DC.W    $0000,$0006,$000D,$0013,$0019,$001F,$0026,$002C
  293. DC.W    $0032,$0038,$003E,$0044,$004A,$0050,$0056,$005C
  294. DC.W    $0062,$0068,$006D,$0073,$0079,$007E,$0084,$0089
  295. DC.W    $008E,$0093,$0099,$009E,$00A2,$00A7,$00AC,$00B1
  296. DC.W    $00B5,$00B9,$00BE,$00C2,$00C6,$00CA,$00CE,$00D1
  297. DC.W    $00D5,$00D8,$00DC,$00DF,$00E2,$00E5,$00E7,$00EA
  298. DC.W    $00ED,$00EF,$00F1,$00F3,$00F5,$00F7,$00F8,$00FA
  299. DC.W    $00FB,$00FC,$00FD,$00FE,$00FF,$00FF,$0100,$0100
  300. DC.W    $0100,$0100,$0100,$00FF,$00FF,$00FE,$00FD,$00FC
  301. DC.W    $00FB,$00FA,$00F8,$00F7,$00F5,$00F3,$00F1,$00EF
  302. DC.W    $00ED,$00EA,$00E7,$00E5,$00E2,$00DF,$00DC,$00D8
  303. DC.W    $00D5,$00D1,$00CE,$00CA,$00C6,$00C2,$00BE,$00B9
  304. DC.W    $00B5,$00B1,$00AC,$00A7,$00A2,$009D,$0098,$0093
  305. DC.W    $008E,$0089,$0084,$007E,$0079,$0073,$006D,$0068
  306. DC.W    $0062,$005C,$0056,$0050,$004A,$0044,$003E,$0038
  307. DC.W    $0032,$002C,$0026,$001F,$0019,$0013,$000D,$0006
  308. DC.W    $0000,$FFFA,$FFF3,$FFED,$FFE7,$FFE1,$FFDA,$FFD4
  309. DC.W    $FFCE,$FFC8,$FFC2,$FFBC,$FFB6,$FFB0,$FFAA,$FFA4
  310. DC.W    $FF9E,$FF98,$FF93,$FF8D,$FF87,$FF82,$FF7C,$FF77
  311. DC.W    $FF72,$FF6D,$FF67,$FF62,$FF5E,$FF59,$FF54,$FF4F
  312. DC.W    $FF4B,$FF47,$FF42,$FF3E,$FF3A,$FF36,$FF32,$FF2F
  313. DC.W    $FF2B,$FF28,$FF24,$FF21,$FF1E,$FF1B,$FF19,$FF16
  314. DC.W    $FF13,$FF11,$FF0F,$FF0D,$FF0B,$FF09,$FF08,$FF06
  315. DC.W    $FF05,$FF04,$FF03,$FF02,$FF01,$FF01,$FF00,$FF00
  316. DC.W    $FF00,$FF00,$FF00,$FF01,$FF01,$FF02,$FF03,$FF04
  317. DC.W    $FF05,$FF06,$FF08,$FF09,$FF0B,$FF0D,$FF0F,$FF11
  318. DC.W    $FF13,$FF16,$FF19,$FF1B,$FF1E,$FF21,$FF24,$FF28
  319. DC.W    $FF2B,$FF2F,$FF32,$FF36,$FF3A,$FF3E,$FF42,$FF47
  320. DC.W    $FF4B,$FF4F,$FF54,$FF59,$FF5E,$FF63,$FF68,$FF6D
  321. DC.W    $FF72,$FF77,$FF7C,$FF82,$FF87,$FF8D,$FF93,$FF98
  322. DC.W    $FF9E,$FFA4,$FFAA,$FFB0,$FFB6,$FFBC,$FFC2,$FFC8
  323. DC.W    $FFCE,$FFD4,$FFDA,$FFE1,$FFE7,$FFED,$FFF3,$FFFA
  324. DC.W    $0000,$0006,$000D,$0013,$0019,$001F,$0026,$002C
  325. DC.W    $0032,$0038,$003E,$0044,$004A,$0050,$0056,$005C
  326. DC.W    $0062,$0068,$006D,$0073,$0079,$007E,$0084,$0089
  327. DC.W    $008E,$0093,$0099,$009E,$00A2,$00A7,$00AC,$00B1
  328. DC.W    $00B5,$00B9,$00BE,$00C2,$00C6,$00CA,$00CE,$00D1
  329. DC.W    $00D5,$00D8,$00DC,$00DF,$00E2,$00E5,$00E7,$00EA
  330. DC.W    $00ED,$00EF,$00F1,$00F3,$00F5,$00F7,$00F8,$00FA
  331. DC.W    $00FB,$00FC,$00FD,$00FE,$00FF,$00FF,$0100,$0100
  332. send:
  333. ; ------------ Copperliste -------------
  334. newcopper:
  335. dc.w     $008e,$2881,$0090,$28c1 ; Bildschirmgrenzen 
  336. dc.w     $0092,$0038,$0094,$00d0 ; DataFetch Start/Stop
  337. dc.w     $0108,$0004,$010a,$0004    ; Modulos
  338. dc.w     $0102,$0001,$0104,$0040 ; Control Reg. #1 u. #2
  339. dc.w     $0100,$2200        ; Control Reg. #0
  340.  
  341. dc.w    $00e0,$0006,$00e2,$1000-44
  342. dc.w    $00e4,$0006,$00e6,$1000
  343.  
  344. dc.w    $0180,$0211,$0182,$0980
  345. dc.w    $0184,$0ff0,$0186,$0cb0
  346. dc.w    $0188,$0ddd,$018a,$0bbb
  347. dc.w    $018c,$0999,$018e,$0866
  348.  
  349. dc.w    $0120,$0000,$0122,$0000
  350. dc.w    $0128,$0000,$012a,$0000
  351. dc.w    $0130,$0000,$0132,$0000
  352. dc.w    $0138,$0000,$013a,$0000
  353.  
  354. dc.w    $ffff,$fffe
  355. ; ------------- Scrolltext -------------
  356. msg:
  357. DC.B    "ALPHA FLIGHT PROUDLY PRESENTS ---       "
  358. DC.B    "A MEGA PRODUCTION FROM DOCTOR MABUSE.   "
  359. DC.B    "THE UNBEATABLE CODER  JEAH!!!  .............        "
  360. ende:
  361. even
  362. ; ---------- Systemregister ------------
  363. gfxbase:    dc.l     0
  364. oldcopper:    dc.l    0
  365. gfxname:
  366. dc.b     "graphics.library",0,0
  367. ; ------ Pointer der Scrollroutine -----
  368.